#ifndef _THREAD_MUTEX_H
#define _THREAD_MUTEX_H

namespace share
{

class Null_Mutex
{
public:
	Null_Mutex( void ) {};
public:
	~Null_Mutex( void ) {};

	int acquire( )
	{
		return 0;
	}
	int release( )
	{
		return 0;
	}
	int close( )
	{
		return 0;
	}
};


class Thread_Mutex
{
	friend class Thread_Condition_Mutex;
public:
	Thread_Mutex( void );
public:
	~Thread_Mutex( void );

	int acquire( );
	int release( );
	int close( );

private:
#ifdef WIN32
	HANDLE	mutex_;
#else
	pthread_mutex_t mutex_;
#endif

};

class Thread_Condition_Mutex
{
public:
	Thread_Condition_Mutex( Thread_Mutex &mutex );
	~Thread_Condition_Mutex( );

	int wait( );
	int signal( );
	int close( );
private:
	Thread_Mutex &mutex_;
#ifdef WIN32
	HANDLE condition_;
#else
	pthread_cond_t condition_;
#endif
};

}
#endif

